home *** CD-ROM | disk | FTP | other *** search
- /* mac06©1998 by HNS/DSITRI hns@computer.org
- ** termios.h
- */
-
- #pragma once
-
- /* baud rates */
-
- #define B0 0
- #define B50 50
- #define B75 75
- #define B110 110
- #define B134 134
- #define B150 150
- #define B200 200
- #define B300 300
- #define B600 600
- #define B1200 1200
- #define B1800 1800
- #define B2400 2400
- #define B4800 4800
- #define B9600 9600
- #define B19200 19200
- #define B38400 38400
- #define B56000 56000
- #define B115000 115000
-
- /* input flags */
-
- #define BRKINT 0x0001
- #define IGNBRK 0x0002
- #define IGNPAR 0x0004
- #define PARMRK 0x0008
- #define INPCK 0x0010
- #define ISTRIP 0x0020
- #define INLCR 0x0040
- #define IGNCR 0x0080
- #define ICRNL 0x0100
- #define IXON 0x0200
- #define IXOFF 0x0400
-
- /* output flags */
-
- #define OPOST 0x0001
- /* control flags */
-
- #define CLOCAL 0x0001
- #define CREAD 0x0002
- #define CSIZE 0x000c
- #define CSTOPB 0x0010
- #define HUPCL 0x0020
- #define PARENB 0x0040
- #define PARODD 0x0080
-
- /* values for CSIZE */
-
- #define CS5 0x0000
- #define CS6 0x0004
- #define CS7 0x0008
- #define CS8 0x000c
-
- /* local flags */
-
- #define ECHO 0x0001
- #define ECHOE 0x0002
- #define ECHOK 0x0004
- #define ECHONL 0x0008
- #define ICANON 0x0010
- #define ISIG 0x0020
- #define NOFLSH 0x0040
- #define TOSTOP 0x0080
- #define IEXTEN 0x0100
-
- /* control characters */
-
- #define VINTR 0
- #define VQUIT 1
- #define VSTART 2
- #define VSUSP 3
- #define VSTOP 4
- /* canonical only */
- #define VEOF 5
- #define VEOL 6
- #define VERASE 7
- #define VKILL 8
- /* not canonical only */
- #define VTIME 5
- #define VMIN 6
- /* number of entries in control character vector */
- #define NCCS 9
-
- /* parameters to tcflush() */
-
- #define TCIFLUSH 1
- #define TCOFLUSH 2
- #define TCIOFLUSH (TCIFLUSH|TCOFLUSH)
-
- /* parameters to tcflow() */
-
- #define TCIOFF 0
- #define TCION 1
- #define TCOOFF 2
- #define TCOON 3
-
- /* parameters to tcsetattr() */
-
- #define TCSADRAIN 0
- #define TCSAFLUSH 1
- #define TCSANOW 2
-
- typedef unsigned char cc_t[NCCS];
- typedef unsigned long speed_t;
- typedef unsigned short tcflag_t; /* up to 16 flags */
-
- struct termios
- {
- tcflag_t c_iflag; /* input flags */
- tcflag_t c_oflag; /* output flags */
- tcflag_t c_cflag; /* control flags */
- tcflag_t c_lflag; /* local flags */
- speed_t __ispeed;
- speed_t __ospeed;
- cc_t c_cc;
- };
-
- speed_t cfgetispeed(const struct termios *ptr);
- speed_t cfgetospeed(const struct termios *ptr);
- int cfsetispeed(struct termios *ptr, speed_t spd);
- int cfsetospeed(struct termios *ptr, speed_t spd);
-
- int tcdrain(int fd);
- int tcflow(int fd, int action);
- int tcflush(int fd, int option);
- int tcsendbreak(int fd, int duration);
- int tcgetattr(int fd, struct termios *ptr);
- int tcsetattr(int fd, int option, struct termios *ptr);
-
- /* EOF */